package com.doctor.windflower_doctor.activity;

import android.app.Dialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RelativeLayout;

import com.doctor.windflower_doctor.R;
import com.doctor.windflower_doctor.util.DisplayUtil;
import com.lidroid.xutils.util.LogUtils;

public class FirstActivity extends BaseActivity {
	private Button register_attestation_Button;
	private RelativeLayout direct_login;
	private Dialog dialog;

	@Override
	protected void getSaveData(Bundle savedInstanceState) {
		// TODO Auto-generated method stub

	}

	@Override
	protected void processLogic() {
		// TODO Auto-generated method stub

	}

	@Override
	protected void setListener() {
		// TODO Auto-generated method stub
		register_attestation_Button.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				View view = LayoutInflater.from(FirstActivity.this).inflate(
						R.layout.call_view, null);

				Button make_sure_button = (Button) view
						.findViewById(R.id.call_button);
				Button cancel_button = (Button) view
						.findViewById(R.id.cancel_button);
				make_sure_button.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View v) {
						// TODO
						// Auto-generated
						// method stub
						Uri uri = Uri.parse("tel:" + "010-56277595");
						Intent intent = new Intent();
						intent.setAction(Intent.ACTION_DIAL);
						intent.setData(uri);
						startActivity(intent);
						dialog.dismiss();
					}
				});
				cancel_button.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View v) {
						// TODO
						// Auto-generated
						// method stub

						dialog.cancel();
					}
				});
				dialog.setContentView(view);
				dialog.show();
				// startActivity(new
				// Intent(FristActivity.this,Registration.class));
			}
		});
		
		direct_login.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				startActivity(new Intent(FirstActivity.this, Login.class));
			}
		});
	}

	@Override
	protected void findViews() {
		register_attestation_Button = (Button) findViewById(R.id.register_attestation_Button);
		direct_login = (RelativeLayout) findViewById(R.id.bottonm);
		dialog = new Dialog(FirstActivity.this);
		dialog.getWindow().setBackgroundDrawableResource(R.color.transparent);
		dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

	}

	@Override
	public int getResLayoutId() {
		// TODO Auto-generated method stub
		return R.layout.frist_activity;
	}

}
